//
//  WeakProxy.m
//  test02
//
//  Created by lzh on 2020/10/26.
//  Copyright © 2020 NO. All rights reserved.
//

#import "WeakProxy.h"

@implementation WeakProxy


+(id)initWithTarget:(id)target{
    
   
    
    return  [self initWithTarget:target];
    
}

-(id)initWithTarget:(id)target{
    
    if (self = [super init]) {
        
        self.target = target;
    }
    
    return self;
}

-(NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector{
    
    if ([self.target respondsToSelector:aSelector]) {
        
         return [self.target methodSignatureForSelector:aSelector];
    }
    
     return  [super methodSignatureForSelector:aSelector];
}

-(void)forwardInvocation:(NSInvocation *)anInvocation{
    
    if ([self.target respondsToSelector:anInvocation.selector]) {
        
        [anInvocation invokeWithTarget:self.target];
    }
    
}

@end
